package com.bwie.system.controller;

import com.bwie.common.domain.request.LoginRequest;
import com.bwie.common.domain.response.UserInfo;
import com.bwie.common.result.Result;
import com.bwie.system.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 控制层
 * @author <a href="mailto:2891704036@qq.com">zhiyuheng</a>
 * @version 1.0
 * @description:
 * @date 2025/8/28 9:02
 */
@RestController
public class SysUserController {

    @Autowired
    private SysUserService sysUserService;

    /**
     * 根据手机号和密码查询用户信息
     * @param loginRequest
     * @return
     */
    @PostMapping("findByPhoneAndPassword")
    public Result<UserInfo> findByPhoneAndPassword(@RequestBody @Valid LoginRequest loginRequest){
        UserInfo userInfo = sysUserService.findByPhoneAndPassword(loginRequest);
        return Result.success(userInfo);
    }
}
